#include "Includes.h"

int main(int argc, char* argv[])
{
	unsigned int scrollSpeed = 25000; // used for parallax speed

	SDL_Surface* screen; // used for the screen window
	
	int flags =0; // setting for the SDL window
	int deltax=0, deltay=0; // change for image

	SDL_Event next_event; // this is used to store events for processing

	int running = true; // application running

	int cur_time = 0;
	int prev_time = 0;
	int delta_t = 0;

	// controling programme framerate
	double time_per_frame = 0.0;
	double fps = 0.0;
	double fps_max = 60.0;

	double delay = 0.0;
	
//----end of init section ----

	if (SDL_Init(SDL_INIT_VIDEO) != 0)
	{
		printf("Unable to initialize SDL: %s\n", SDL_GetError());
		return true;
	}
	
	atexit(SDL_Quit);

	flags = SDL_DOUBLEBUF;

	screen = SDL_SetVideoMode(640, 480, 24, flags);
	if (screen == NULL)
	{
		printf("Unable to set video mode: %s\n", SDL_GetError());
		return true;
	}
	
	Bitmap *bilde = new Bitmap("images/mountains.png", 0, 0, 1022, 423);

	// ----Create screen objects----



// ----End of screen object section----


	prev_time = SDL_GetTicks();
	cur_time = SDL_GetTicks();

	while(running)
	{
		prev_time = cur_time;
		cur_time = SDL_GetTicks();
		delta_t = cur_time-prev_time;

		time_per_frame = time_per_frame*0.9 + ((cur_time-prev_time)/10.0);
		fps = 1000/time_per_frame;

		while(SDL_PollEvent(&next_event))
		{
			switch(next_event.type)
			{
				case SDL_KEYUP:
					break;
				case SDL_KEYDOWN:
					break;
				case SDL_QUIT:
					running = false;
					break;
			}
		}

		//render shit
		
		bilde->blit(screen);
		
		SDL_Flip(screen);
	}

	return 0;
}
